/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.ejb.controleProjeto.entidade;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "release", catalog = "macielqs", schema = "controleprojeto")
@NamedQueries({
    @NamedQuery(name = "Release.findAll", query = "SELECT r FROM Release r"),
    @NamedQuery(name = "Release.findById", query = "SELECT r FROM Release r WHERE r.id = :id"),
    @NamedQuery(name = "Release.findByPrevIni", query = "SELECT r FROM Release r WHERE r.prevIni = :prevIni"),
    @NamedQuery(name = "Release.findByPrevFim", query = "SELECT r FROM Release r WHERE r.prevFim = :prevFim"),
    @NamedQuery(name = "Release.findByEfetIni", query = "SELECT r FROM Release r WHERE r.efetIni = :efetIni"),
    @NamedQuery(name = "Release.findByEfetFim", query = "SELECT r FROM Release r WHERE r.efetFim = :efetFim"),
    @NamedQuery(name = "Release.findByStatus", query = "SELECT r FROM Release r WHERE r.status = :status"),
    @NamedQuery(name = "Release.findByObservacoes", query = "SELECT r FROM Release r WHERE r.observacoes = :observacoes"),
    @NamedQuery(name = "Release.findByProfissionalId", query = "SELECT r FROM Release r WHERE r.profissionalId = :profissionalId")})
public class Release implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "prev_ini", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date prevIni;
    @Basic(optional = false)
    @Column(name = "prev_fim", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date prevFim;
    @Column(name = "efet_ini")
    @Temporal(TemporalType.DATE)
    private Date efetIni;
    @Column(name = "efet_fim")
    @Temporal(TemporalType.DATE)
    private Date efetFim;
    @Basic(optional = false)
    @Column(name = "status", nullable = false, length = 25)
    private String status;
    @Basic(optional = false)
    @Column(name = "observacoes", nullable = false, length = 2147483647)
    private String observacoes;
    @Basic(optional = false)
    @Column(name = "profissional_id", nullable = false)
    private int profissionalId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "release")
    private List<Artefato> artefatoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "release")
    private List<Diario> diarioList;
    @JoinColumn(name = "projeto_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Projeto projeto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "release")
    private List<Atividade> atividadeList;

    public Release() {
    }

    public Release(Integer id) {
        this.id = id;
    }

    public Release(Integer id, Date prevIni, Date prevFim, String status, String observacoes, int profissionalId) {
        this.id = id;
        this.prevIni = prevIni;
        this.prevFim = prevFim;
        this.status = status;
        this.observacoes = observacoes;
        this.profissionalId = profissionalId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getPrevIni() {
        return prevIni;
    }

    public void setPrevIni(Date prevIni) {
        this.prevIni = prevIni;
    }

    public Date getPrevFim() {
        return prevFim;
    }

    public void setPrevFim(Date prevFim) {
        this.prevFim = prevFim;
    }

    public Date getEfetIni() {
        return efetIni;
    }

    public void setEfetIni(Date efetIni) {
        this.efetIni = efetIni;
    }

    public Date getEfetFim() {
        return efetFim;
    }

    public void setEfetFim(Date efetFim) {
        this.efetFim = efetFim;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getObservacoes() {
        return observacoes;
    }

    public void setObservacoes(String observacoes) {
        this.observacoes = observacoes;
    }

    public int getProfissionalId() {
        return profissionalId;
    }

    public void setProfissionalId(int profissionalId) {
        this.profissionalId = profissionalId;
    }

    public List<Artefato> getArtefatoList() {
        return artefatoList;
    }

    public void setArtefatoList(List<Artefato> artefatoList) {
        this.artefatoList = artefatoList;
    }

    public List<Diario> getDiarioList() {
        return diarioList;
    }

    public void setDiarioList(List<Diario> diarioList) {
        this.diarioList = diarioList;
    }

    public Projeto getProjeto() {
        return projeto;
    }

    public void setProjeto(Projeto projeto) {
        this.projeto = projeto;
    }

    public List<Atividade> getAtividadeList() {
        return atividadeList;
    }

    public void setAtividadeList(List<Atividade> atividadeList) {
        this.atividadeList = atividadeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Release)) {
            return false;
        }
        Release other = (Release) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.controleProjeto.entidade.Release[id=" + id + "]";
    }

}
